package com.jblog.core.model.account;

import java.io.Serializable;
import java.sql.Timestamp;

public class Log implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;
    private Account account;
    private String ip;
    private Timestamp loginTime = new Timestamp(System.currentTimeMillis());

    public Log() {
    }

    public Log(Long userId, String ip) {
        this.account = new Account(userId);
        this.ip = ip;
    }

    public Log(Account account, String ip) {
        this.account = account;
        this.ip = ip;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getIp() {
        return ip;
    }

    public Account getAccount() {
        return account;
    }

    public void setAccount(Account account) {
        this.account = account;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Timestamp getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Timestamp loginTime) {
        this.loginTime = loginTime;
    }

    @Override
    public String toString() {
        return "Log [id=" + id + ", account=" + account + "]";
    }

}
